<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <input type="text" class="ipt1" />
    <select>
      <option>+</option>
      <option>-</option>
      <option>*</option>
      <option>/</option>
    </select>
    <input type="text" class="ipt2" />
    <button class="btn1">点击运算</button>
    <input type="text" class="ipt3" />
    <hr />
    <input type="text" class="ipt4" />
    <input type="text" class="ipt5" />
    <button class="btn2">所有水仙花数</button>
    <input type="text" class="ipt6" />
    <hr />
    <input type="text" class="ipt7" />
    <input type="text" class="ipt8" />
    <button class="btn3">点我</button>
    <input type="text" class="ipt9" />
    <hr />
    <input type="text" class="ipt10" />
    <button class="btn4">点我</button>
    <input type="text" class="ipt11" />
    <hr />
    <input type="text" class="ipt12" />
    <input type="text" class="ipt13" />
    <button class="btn5">点我</button>
    <input type="text" class="ipt14" />
    <hr />
    <input type="text" class="ipt15" />
    <input type="text" class="ipt16" />
    <button class="btn6">点我</button>
    <input type="text" class="ipt17" />
  </body>
</html>
<script>
  var oIpt1 = document.querySelector(".ipt1");
  var oIpt2 = document.querySelector(".ipt2");
  var oIpt3 = document.querySelector(".ipt3");
  var oBtn1 = document.querySelector(".btn1");
  var oSelect = document.querySelector("select");

  var oIpt4 = document.querySelector(".ipt4");
  var oIpt5 = document.querySelector(".ipt5");
  var oIpt6 = document.querySelector(".ipt6");
  var oBtn2 = document.querySelector(".btn2");
  var str1 = " ";

  var oIpt7 = document.querySelector(".ipt7");
  var oIpt8 = document.querySelector(".ipt8");
  var oIpt9 = document.querySelector(".ipt9");
  var oBtn3 = document.querySelector(".btn3");
  var str2 = " ";

  var oIpt10 = document.querySelector(".ipt10");
  var oIpt11 = document.querySelector(".ipt11");
  var oBtn4 = document.querySelector(".btn4");

  var oIpt12 = document.querySelector(".ipt12");
  var oIpt13 = document.querySelector(".ipt13");
  var oIpt14 = document.querySelector(".ipt14");
  var oBtn5 = document.querySelector(".btn5");

  var oIpt15 = document.querySelector(".ipt15");
  var oIpt16 = document.querySelector(".ipt16");
  var oIpt17 = document.querySelector(".ipt17");
  var oBtn6 = document.querySelector(".btn6");
  oBtn1.onclick = function () {
    switch (oSelect.value) {
      case "+":
        oIpt3.value = oIpt1.value * 1 + oIpt2.value * 1;
        break;
      case "-":
        oIpt3.value = oIpt1.value * 1 - oIpt2.value * 1;
        break;
      case "*":
        oIpt3.value = oIpt1.value * 1 * oIpt2.value * 1;
        break;
      case "/":
        oIpt3.value = ((oIpt1.value * 1) / oIpt2.value) * 1;
        break;

      default:
        break;
    }
  };
  oBtn2.onclick = function () {
    for (var i = oIpt4.value; i <= oIpt5.value; i++) {
      var g = i % 10;
      var s = parseInt((i / 10) % 10);
      var b = parseInt(i / 100);
      if (g * g * g + s * s * s + b * b * b == i) {
        str1 += i + " ";
      }
    }
    oIpt6.value = str1;
  };
  oBtn3.onclick = function () {
    for (var i = oIpt7.value; i <= oIpt8.value; i++) {
      var g = i % 10;
      var s = parseInt(i / 10);
      if (i % 7 == 0 || g == 7 || s == 7) {
        str2 += i + " ";
      }
    }
    oIpt9.value = str2;
  };
  oBtn4.onclick = function () {
    if (
      (oIpt10.value % 4 === 0 && oIpt10.value % 100 !== 0) ||
      oIpt10.value / 400 === 0
    ) {
      oIpt11.value = oIpt10.value + "是闰年";
    } else {
      oIpt11.value = oIpt10.value + "不是闰年";
    }
  };
  oBtn5.onclick = function () {
    var sum = 0;
    for (var i = oIpt12.value * 1; i <= oIpt13.value * 1; i++) {
      if (i % 2 == 0) {
        sum += i;
      }
    }
    oIpt14.value = sum;
  };
  oBtn6.onclick = function () {
    var count = 0;
    for (var i = oIpt15.value; i <= oIpt16.value; i++) {
      var g = i % 10;
      var s = parseInt((i / 10) % 10);
      var b = parseInt(i / 100);
      if (g * g * g + s * s * s + b * b * b == i) {
        count++;
      }
    }
    oIpt17.value = count;
  };
</script>
